/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package myftp.app.view;

import java.awt.FlowLayout;
import javax.swing.JButton;
import myftp.app.form.ConnectForm;
import myftp.app.view.listener.ConnectActionListener;
import myftp.app.view.listener.SaveServerActionListener;
import myftp.core.view.AbstractView;

/**
 *
 * @author CAVARLE Glenn, LUCAS Stéphane
 * Vue de la barre de connexion rapide
 */
public class ConnectBarPartView extends AbstractView {

    /**
     * Form contenant les infos du serveur
     * @var form
     */
    ConnectForm form = new ConnectForm();
    /**
     * Bouton de connexion au serveur
     * @var connectBtn
     */
    JButton connectBtn = new JButton("Connexion");
    /**
     * Bouton de sauvegarde du serveur
     * @var saveBtn
     */
    JButton saveBtn = new JButton("Enregistrer");

    public ConnectBarPartView init() {

        /* Ajoute les différents éléments à la vue */
        this.setLayout(new FlowLayout());
        this.add(form.hostLabel);
        this.add(form.hostField);
        this.add(form.loginLabel);
        this.add(form.loginField);
        this.add(form.passwdLabel);
        this.add(form.passwdField);
        this.add(form.portLabel);
        this.add(form.portField);

        /* Ajout des listener */
        this.connectBtn.addActionListener(new ConnectActionListener());
        this.add(connectBtn);
        this.saveBtn.addActionListener(new SaveServerActionListener());
        this.add(saveBtn);

        return this;

    }

    public Object getForm() {
        return this.form;
    }
}
